﻿#pragma once

#include "DeviceValveBase.h"
#include <future>

namespace DeviceLayer
{

class DeviceDemoValve : public DeviceValveBase
{
    DECLARE_DYNAMIC_CREATE(DeviceDemoValve);

    std::atomic<bool> status { false };  //阀门当前状态
    int delay { 100 };      //模拟阀门打开关闭的延时

    std::future<void> onAsyncFuture;
    std::future<void> offAsyncFuture;
public:
    DeviceDemoValve();

    virtual bool On() override;
    virtual bool Off() override;
    virtual bool IsOn() const override { return status; }

    virtual bool InitFromSettingData(const QString& path) override;
    virtual bool QueryData() override;
};

}
